-- fruits
-- created by panyl
-- 地牢格子：果实

return {
    restoreGrid = function(grid, info)
        grid.fruit = info.fruit;
    end,

    -- 收集上下文
    collectContext = function(grid)
        return { ["fruit"] = grid.fruit, };
    end,

    autoFight = function(grid)
        local pos = grid:getPos();
        if DungeonInstanceM.isInInstance() then
            if DungeonM.isAllMonsterDead() then
                return DungeonActionM.go("take_instance_bonus", pos);
            end
        else
            return DungeonActionM.go("take_fruit", pos);
        end
        return false;
    end
};
